package MySQL::Query::Performance::GroupBy;

use strict;
use warnings;
use Carp;

use SQL::Builder::Select;
use SQL::Builder::Function;

sub new {
    	my ($class , %arg) = @_;
	
	my $self = bless { }, $class;
	return $self;
}

sub create_groupby_sql {
	my ($self , $table , $row) = @_;
	
	my $sel = SQL::Builder::Select->new();
	$sel->tables->add_table(table => $table);
	
	my $col = SQL::Builder::Column->new();
	$col->col($row);
	$sel->cols->list_push($col);
	
	my $func = SQL::Builder::Function->new();
	$func->name("COUNT");
	$func->args->list_push(2);
	$sel->cols->list_push($func);
	
	$sel->groupby->list_push($row);
	
	return $sel;
}

1;

=head1 NAME

MySQL::Query::Performance::GroupBy

=head1 SYNOPSIS
	
=head1 DESCRIPTION

=head1 METHODS

=head2 new()

=head2 create_groupby_sql()

